using System.Collections.Generic;

public class GameStateCaretaker{
    private Queue<GameStateMemento> _gameStateMementos = new Queue<GameStateMemento>();

    public void SaveGameState(GameStateMemento gameStateMemento){
        _gameStateMementos.Enqueue(gameStateMemento);
    }

    public GameStateMemento? GetGameStateMemento(){
        return _gameStateMementos.TryDequeue(out GameStateMemento gameStateMemento) ? gameStateMemento : null;
    }
}